package com.zhw.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.zhw.intercept.loginCheckIntercept;

//加上这个注解，代表这个类为配置类
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    loginCheckIntercept loginCheckIntercept;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginCheckIntercept)
                .addPathPatterns("/**")
                .excludePathPatterns("/login");
    }
}
